package hiho.ku._1239;

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	
	private static final int BIGINT = 1000000007;

	public static void main(String[] args) {
		int[] f = new int[30];
		f[0] = 1;
		f[1] = 2;
		for (int i = 2; i < 30; i++)
			f[i] = f[i - 1] + f[i - 2];
		
		Scanner in = new Scanner(System.in);
		int[] g = new int[30];
		int n = in.nextInt();
		for (int i = 0; i < n; i++) {
			int x = in.nextInt();
			if (x == 1) {
				g[1] = (g[1] + g[0]) % BIGINT;
				g[0]++;
			} else {
				int p = Arrays.binarySearch(f, x);
				if (p < 0)
					continue;
				g[p + 1] = (g[p + 1] + g[p]) % BIGINT; 
			}
		}
		
		int ans = 0;
		for (int i = 0; i < 30; i++)
			ans = (ans + g[i]) % BIGINT;
		System.out.println(ans);
	}

}
